Skip to content

fix(preview): order previews by ID during pagination - #63249

Merged
come-nc merged 1 commit into
masterfrom
jtr/fix-previewMapper-getPreviews-ordering
Aug 18, 2026
Merged

fix(preview): order previews by ID during pagination#63249
come-nc merged 1 commit into
masterfrom
jtr/fix-previewMapper-getPreviews-ordering

Conversation

@joshtrichards

@joshtrichards joshtrichards commented Aug 14, 2026

Copy link
Copy Markdown
Member
  • Resolves: #

Summary

Ensure preview pagination is deterministic by ordering results by preview ID.

PreviewMapper::getPreviews() uses p.id > $lastId as a cursor and limits each query to a fixed number of rows. Without an explicit ORDER BY, SQL does not guarantee the order of returned rows.

This can cause cursor-based cleanup to skip previews or process batches inconsistently.

Changes:

  • Order getPreviews() results by p.id ASC.
  • Qualify the mtime predicate with the p table alias (not currently a problem since there's no overlapping joined column name, but makes the query clearer).
  • Tidy formatting.

TODO

  • ...

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards joshtrichards added this to the Nextcloud 35 milestone Aug 14, 2026
@joshtrichards
joshtrichards requested a review from a team as a code owner August 14, 2026 16:14
@joshtrichards
joshtrichards requested review from come-nc and icewind1991 and removed request for a team August 14, 2026 16:14
@joshtrichards

Copy link
Copy Markdown
Member Author

/backport to stable34

@joshtrichards

Copy link
Copy Markdown
Member Author

/backport to stable33

@come-nc
come-nc merged commit 5a01a2e into master Aug 18, 2026
251 checks passed
@come-nc
come-nc deleted the jtr/fix-previewMapper-getPreviews-ordering branch August 18, 2026 07:14
@nextcloud-bot nextcloud-bot mentioned this pull request Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants